file(GLOB_RECURSE X_FILES "${CMAKE_SOURCE_DIR}/xapps/x/*.*")
file(GLOB_RECURSE COMMON_FILES "${CMAKE_SOURCE_DIR}/src/common/*.*")
file(GLOB_RECURSE TOOLS_FILES "${CMAKE_SOURCE_DIR}/src/tools/filecheck/*.*")
file(GLOB_RECURSE X_HASH_FILES "${CMAKE_CURRENT_LIST_DIR}/src/*.*")
set(PRO_FILES ${CMAKE_CURRENT_LIST_DIR}/xHash.rc)
list(APPEND PRO_FILES ${CMAKE_CURRENT_LIST_DIR}/xHash.qrc)
list(APPEND PRO_FILES ${X_FILES})
list(APPEND PRO_FILES ${COMMON_FILES})
list(APPEND PRO_FILES ${TOOLS_FILES})
list(APPEND PRO_FILES ${X_HASH_FILES})

include_directories(${CMAKE_SOURCE_DIR}/xapps)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${X_BINS_DIR}/xHash)
qt_add_executable(xHash ${PRO_FILES})
x_deploy_qt(xHash)
x_generate_translations(xHash)
target_link_libraries(xHash PRIVATE Qt6::Core Qt6::Gui Qt6::Svg Qt6::Widgets Qt6::Network)
target_link_libraries(xHash PRIVATE Qt6::SerialPort)
if(X_USING_VS_CODE)
  set_target_properties(xHash PROPERTIES MACOSX_BUNDLE TRUE)
else()
  set_target_properties(xHash PROPERTIES MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE)
endif()

if(X_ICONV)
  target_link_libraries(xHash PRIVATE ${X_ICONV})
endif()

if(WIN32)
  target_link_libraries(xHash PRIVATE Dwmapi)
elseif(LINUX)
  target_link_libraries(xHash PRIVATE dl)
endif()
